import io.qt.core.Qt
import io.qt.widgets.QHBoxLayout
import io.qt.widgets.QLineEdit
import io.qt.widgets.QPushButton
import io.qt.widgets.QWidget

class AppSearchLine(parent: QWidget) : QLineEdit(parent) {
    private val mainLayout = QHBoxLayout()
    private val searchBtn = QPushButton()


    init {
        searchBtn.setFixedSize(13, 13)
        searchBtn.setCursor(Qt.CursorShape.PointingHandCursor)
        searchBtn.toolTip = tr("搜索")
        searchBtn.styleSheet =
            "QPushButton{border-image::url(:/res/search@2x.png);background:transparent;cursor:pointer;}"
        placeholderText = tr("搜索")
        mainLayout.addWidget(searchBtn)
        mainLayout.addStretch()
        //mainLayout.setContentsMargins(8,8,8,8);
        mainLayout.setContentsMargins(8, 0, 0, 0)
        setTextMargins(13 + 8 + 2, 0, 0, 0)
        setContentsMargins(0, 0, 0, 0)
        setLayout(mainLayout)
        styleSheet = "height:29px;border:1px solid #eaeaea;border-radius:14px;"
    }
}
